#!/usr/bin/env python

#
# Generated Tue May 18 00:30:16 2010 by generateDS.py version 1.20e.
#

import sys
from string import lower as str_lower
from xml.dom import minidom

import ??? as supermod

#
# Globals
#

ExternalEncoding = 'ascii'

#
# Data representation classes
#

class sceneSub(supermod.scene):
    def __init__(self, head=None, body=None):
        supermod.scene.__init__(self, head, body)
supermod.scene.subclass = sceneSub
# end class sceneSub


class headSub(supermod.head):
    def __init__(self, objectdef=None):
        supermod.head.__init__(self, objectdef)
supermod.head.subclass = headSub
# end class headSub


class objectdefSub(supermod.objectdef):
    def __init__(self, name=None, triangleset=None, cuboid=None, barrel=None, globe=None, teapot=None):
        supermod.objectdef.__init__(self, name, triangleset, cuboid, barrel, globe, teapot)
supermod.objectdef.subclass = objectdefSub
# end class objectdefSub


class trianglesetSub(supermod.triangleset):
    def __init__(self, reflectivity='0,0,0', name=None, emission='0,0,0', radiosity='0,0,0', triangle=None, trianglenext=None):
        supermod.triangleset.__init__(self, reflectivity, name, emission, radiosity, triangle, trianglenext)
supermod.triangleset.subclass = trianglesetSub
# end class trianglesetSub


class triangleSub(supermod.triangle):
    def __init__(self, refr=0.0, emission='0,0,0', reflectivity='0,0,0', radiosity='0,0,0', refl=0.0, spec=1.0, vertex=None):
        supermod.triangle.__init__(self, refr, emission, reflectivity, radiosity, refl, spec, vertex)
supermod.triangle.subclass = triangleSub
# end class triangleSub


class vertexSub(supermod.vertex):
    def __init__(self, y=None, x=None, z=None, valueOf_=''):
        supermod.vertex.__init__(self, y, x, z, valueOf_)
supermod.vertex.subclass = vertexSub
# end class vertexSub


class trianglenextSub(supermod.trianglenext):
    def __init__(self, vertex=None):
        supermod.trianglenext.__init__(self, vertex)
supermod.trianglenext.subclass = trianglenextSub
# end class trianglenextSub


class cuboidSub(supermod.cuboid):
    def __init__(self, reflectivity='0,0,0', name=None, emission='0,0,0', radiosity='0,0,0', valueOf_=''):
        supermod.cuboid.__init__(self, reflectivity, name, emission, radiosity, valueOf_)
supermod.cuboid.subclass = cuboidSub
# end class cuboidSub


class barrelSub(supermod.barrel):
    def __init__(self, reflectivity='0,0,0', name=None, emission='0,0,0', radiosity='0,0,0', valueOf_=''):
        supermod.barrel.__init__(self, reflectivity, name, emission, radiosity, valueOf_)
supermod.barrel.subclass = barrelSub
# end class barrelSub


class globeSub(supermod.globe):
    def __init__(self, reflectivity='0,0,0', name=None, emission='0,0,0', radiosity='0,0,0', valueOf_=''):
        supermod.globe.__init__(self, reflectivity, name, emission, radiosity, valueOf_)
supermod.globe.subclass = globeSub
# end class globeSub


class teapotSub(supermod.teapot):
    def __init__(self, reflectivity='0,0,0', name=None, emission='0,0,0', radiosity='0,0,0', valueOf_=''):
        supermod.teapot.__init__(self, reflectivity, name, emission, radiosity, valueOf_)
supermod.teapot.subclass = teapotSub
# end class teapotSub


class bodySub(supermod.body):
    def __init__(self, apply_macro=None, macro=None, object=None):
        supermod.body.__init__(self, apply_macro, macro, object)
supermod.body.subclass = bodySub
# end class bodySub


class apply_macroSub(supermod.apply_macro):
    def __init__(self, name=None, valueOf_=''):
        supermod.apply_macro.__init__(self, name, valueOf_)
supermod.apply_macro.subclass = apply_macroSub
# end class apply_macroSub


class macroSub(supermod.macro):
    def __init__(self, name=None, apply_macro=None, rotate=None, translate=None, scale=None, shear=None):
        supermod.macro.__init__(self, name, apply_macro, rotate, rotate, translate, scale, shear)
supermod.macro.subclass = macroSub
# end class macroSub


class rotateSub(supermod.rotate):
    def __init__(self, dz=0.0, angle=0.0, dx=0.0, dy=0.0, apply_macro=None, object=None, rotate=None, translate=None, scale=None, shear=None):
        supermod.rotate.__init__(self, dz, angle, dx, dy, apply_macro, object, rotate, translate, scale, shear)
supermod.rotate.subclass = rotateSub
# end class rotateSub


class objectSub(supermod.object):
    def __init__(self, name=None, valueOf_=''):
        supermod.object.__init__(self, name, valueOf_)
supermod.object.subclass = objectSub
# end class objectSub


class translateSub(supermod.translate):
    def __init__(self, dz=0.0, dx=0.0, dy=0.0, apply_macro=None, object=None, rotate=None, translate=None, scale=None, shear=None):
        supermod.translate.__init__(self, dz, dx, dy, apply_macro, object, rotate, translate, scale, shear)
supermod.translate.subclass = translateSub
# end class translateSub


class scaleSub(supermod.scale):
    def __init__(self, dz=0.0, dx=0.0, dy=0.0, apply_macro=None, object=None, rotate=None, translate=None, scale=None, shear=None):
        supermod.scale.__init__(self, dz, dx, dy, apply_macro, object, rotate, translate, scale, shear)
supermod.scale.subclass = scaleSub
# end class scaleSub


class shearSub(supermod.shear):
    def __init__(self, dz=0.0, dx=0.0, dy=0.0, apply_macro=None, object=None, rotate=None, translate=None, scale=None, shear=None):
        supermod.shear.__init__(self, dz, dx, dy, apply_macro, object, rotate, translate, scale, shear)
supermod.shear.subclass = shearSub
# end class shearSub



def parse(inFilename):
    doc = minidom.parse(inFilename)
    rootNode = doc.documentElement
    rootObj = supermod.scene.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_="scene",
        namespacedef_='')
    doc = None
    return rootObj


def parseString(inString):
    doc = minidom.parseString(inString)
    rootNode = doc.documentElement
    rootObj = supermod.scene.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_="scene",
        namespacedef_='')
    return rootObj


def parseLiteral(inFilename):
    doc = minidom.parse(inFilename)
    rootNode = doc.documentElement
    rootObj = supermod.scene.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('#from ??? import *\n\n')
    sys.stdout.write('import ??? as model_\n\n')
    sys.stdout.write('rootObj = model_.scene(\n')
    rootObj.exportLiteral(sys.stdout, 0, name_="scene")
    sys.stdout.write(')\n')
    return rootObj


USAGE_TEXT = """
Usage: python ???.py <infilename>
"""

def usage():
    print USAGE_TEXT
    sys.exit(1)


def main():
    args = sys.argv[1:]
    if len(args) != 1:
        usage()
    infilename = args[0]
    root = parse(infilename)


if __name__ == '__main__':
    #import pdb; pdb.set_trace()
    main()


